<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:p="http://primefaces.org/ui">
	
	<ui:composition template="template/template.xhtml">
		<ui:define  name="page-title" >#{messages.centrosDepositos}</ui:define >
		<ui:define  name="center">
			<p:commandButton action="#{centroController.novoCentro}" value="#{messages.novoCentro}" ajax="false"/>
           	<p:dataTable id="tabelaCentros" var="centro" value="#{centroController.centros}" paginator="true" rows="10" paginatorPosition="bottom"
		       	paginatorTemplate="{CurrentPageReport}  {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink}" rowsPerPageTemplate="5,10,15">  
		        
		        <f:facet name="header">  
		           	#{messages.centros}
		        </f:facet>  
		  
		        <p:column>  
		            <f:facet name="header">  
		                <h:outputText value="#{messages.id}" />  
		            </f:facet>  
		            <h:outputText value="#{centro.id}" />  
		        </p:column>  
		  
		        <p:column>  
		            <f:facet name="header">  
		                <h:outputText value="#{messages.nome}" />  
		            </f:facet>  
		            <h:outputText value="#{centro.nome}" />  
		        </p:column>  
		  
		        <p:column>  
		            <f:facet name="header">  
		                <h:outputText value="#{messages.morada}" />  
		            </f:facet>  
		            <h:outputText value="#{centro.morada}" />  
		        </p:column>  
	  			<p:column style="width:40px">  
		            <p:commandLink action="centro" style="display: inline-block" styleClass="ui-icon ui-icon-search"  ajax="false">
		            	<f:param name="centroId" value="#{centro.id}" />
		            </p:commandLink>
		        </p:column>
	   		</p:dataTable>
	   		
	   		<p:separator id="separator" /> 
	   		 
	   		<p:commandButton action="#{centroController.novoDeposito}" value="#{messages.novoDeposito}" ajax="false"/>
	   		<p:dataTable id="tabelaDepositos" var="deposito" value="#{centroController.depositos}" paginator="true" rows="10" paginatorPosition="bottom"
		       	paginatorTemplate="{CurrentPageReport}  {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink}" rowsPerPageTemplate="5,10,15">  
		        
		        <f:facet name="header">  
		           	#{messages.depositos}
		        </f:facet>  
		  
		        <p:column>  
		            <f:facet name="header">  
		                <h:outputText value="#{messages.id}" />  
		            </f:facet>  
		            <h:outputText value="#{deposito.id}" />  
		        </p:column>  
		        
		        <p:column>  
		            <f:facet name="header">  
		                <h:outputText value="#{messages.tipo}" />  
		            </f:facet>  
		            <h:outputText value="#{deposito.tipoDeposito}" />  
		        </p:column>  
		  
		        <p:column>  
		            <f:facet name="header">  
		                <h:outputText value="#{messages.nome}" />  
		            </f:facet>  
		            <h:outputText value="#{deposito.nome}" />  
		        </p:column>  
		  
		        <p:column>  
		            <f:facet name="header">  
		                <h:outputText value="#{messages.centro}" />  
		            </f:facet>  
		            <h:outputText value="#{deposito.centro.nome}" />  
		        </p:column>  
	  			
	  			<p:column style="width:60px">  
		            <p:commandLink action="deposito" style="display: inline-block" styleClass="ui-icon ui-icon-search">
		            	<f:param name="depositoId" value="#{deposito.id}" />
		            </p:commandLink>
		        </p:column>
	     
	   		</p:dataTable>
		</ui:define >
	</ui:composition>
	
</html>